<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('spin_wheel_lottery_log', function (Blueprint $table) {
            $table->engine  = 'InnoDB';
            $table->comment('转盘抽奖日志');

            $table->increments('id');
            $table->integer('game_id')->comment('游戏id')->unsigned()->default(0);
            $table->string('openid', 128)->comment('渠道用户唯一id')->default('');
            $table->string('prize_name', 128)->comment('奖品名称')->default('');
            $table->tinyInteger('is_entity')->comment('是否是实物 1是')->unsigned()->default(1);
            $table->string('name', 128)->comment('姓名')->default('');
            $table->char('phone', 11)->comment('手机号')->default('');
            $table->string('address', 256)->comment('地址')->default('');
            $table->tinyInteger('is_send')->comment('是否发货 1是')->unsigned()->default(1);
            $table->integer('create_time')->comment('创建时间')->unsigned()->default(0);
            $table->integer('send_time')->comment('发货时间')->unsigned()->default(0);

            $table->index('game_id');
            $table->index('openid');
            $table->index('phone');
            $table->index('create_time');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('spin_wheel_lottery_log');
    }
};
